Custom Dashboard Improvements#1359
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR introduces a context chip bar for the AI dashboard chat panel — users can click widgets in the sandbox iframe, trigger "Add a component", or auto-capture runtime errors as chips that are prepended to the next AI request. It also adds a Confidence Score: 5/5Safe to merge; all findings are P2 style/UX improvements with no blocking correctness issues. All three inline comments are P2: chip consumption timing is a minor UX annoyance (chips can be re-added), the module-level singleton only breaks in an edge case not present in the current UI, and the stale-ref window is extremely small. No data loss, security, or primary-path breakage. chat-adapters.ts (chip consumption timing) and dashboard-tool-components.tsx (module-level singletons) Important Files Changed
Sequence DiagramsequenceDiagram
participant U as User
participant IFrame as Sandbox iframe
participant Host as DashboardSandboxHost
participant Page as page-client
participant Chat as AssistantChat / ChipBar
participant Adapter as createDashboardChatAdapter
participant AI as AI Stream API
U->>IFrame: hover widget / click Add to chat
IFrame->>Host: postMessage(dashboard-widget-selected)
Host->>Page: onWidgetSelected(selection)
Page->>Page: setPendingChips([...prev, widgetChip])
IFrame->>Host: postMessage(dashboard-error-boundary)
Host->>Page: onRuntimeError(err)
Page->>Page: setPendingChips([...prev, errorChip])
Page->>Chat: composerTopContent=ChipBar
U->>Chat: submit composer
Chat->>Adapter: run({ messages })
Adapter->>Adapter: getPendingChips() inject into last user message
Adapter->>Adapter: consumePendingChips()
Adapter->>AI: streamDashboardCode(messages + chips)
AI-->>Adapter: stream ChatContent chunks
Adapter-->>Chat: yield content
Adapter->>Page: onPatchApplied / onToolCall
Page->>IFrame: updated srcDoc (new TSX source)
|
This PR introduces a context chip bar for the AI dashboard chat panel — users can click widgets in the sandbox iframe, trigger "Add a component", or auto-capture runtime errors as chips that are prepended to the next AI request. It also adds a patchDashboard tool for surgical find-and-replace edits alongside the existing updateDashboard, streaming dashboard generation, and an improved system prompt with hook-ordering guidance for generated components.